package com.lanyun.carworld.controller.admin;

import com.lanyun.carworld.common.BaseResponse;
import com.lanyun.carworld.common.ResultUtils;
import com.lanyun.carworld.model.dto.user.PostSearchRequest;
import com.lanyun.carworld.model.dto.user.UserSearchRequest;
import com.lanyun.carworld.model.vo.UserVO;
import com.lanyun.carworld.service.UserService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController("AdminUserController")
@RequestMapping("/admin/user")
@Api(tags = "后台-用户管理")
@Slf4j
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping("/list")
    public BaseResponse<List<UserVO>> list(UserSearchRequest request) {

        log.info("查询用户列表:{}",request);


        List<UserVO> userVOList = userService.getUserList(request);

        return ResultUtils.success(userVOList);
    }
}
